<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
	<title></title>
	<link rel="stylesheet" href="http://localhost/ZBZphp/wowsai/Static/admin/Bootstrap/Css/bootstrap.min.css" />
	<link rel="stylesheet" href="http://localhost/ZBZphp/wowsai/Static/admin/Css/common.css" />
	<script type="text/javascript" src="http://localhost/ZBZphp/wowsai/Static/admin/Js/jquery-1.7.2.min.js"></script>
</head>
<body>
	<form action="" method="post">
		<div class="container-fluid">
			<div class="row-fluid">
				<div class="span12">
					<table class="table table-bordered table-hover">
						<thead>
							<tr>
								<th>分类ID</th>
								<th>分类名称</th>
								<th>排序</th>
								<th>操作</th>
							</tr>
						</thead>
						<tbody>
							<?php foreach ($cateData as $k=>$v){?>
								<form action="" method="post">
								<tr class="info" pid='<?php echo $v['pid'];?>'     <?php if($v['pid']){ ?> style="display:none"<?php } ?> >
									<td>
										<?php echo $v['cid'];?>
									</td>
									<td class='open' cid='<?php echo $v['cid'];?>' style="cursor: pointer;">
										<?php echo $v['_name'];?>
									</td>
									<td>
										<input type="text" name='csort[<?php echo $v['cid'];?>]' value='<?php echo $v['csort'];?>'/>
									</td>
									<td>
										<a href="<?php echo U('addSonCate',array('cid'=>$v['cid']));?>" class="btn btn-success"><i class="icon-edit icon-white"></i>添加子分类</a>
										<a href="<?php echo U('edit',array('cid'=>$v['cid']));?>" class="btn btn-warning"><i class="icon-pencil icon-white"></i>修改</a>
										<a href="javascript:;" class="btn btn-danger" onclick="if(confirm('确定要删除')) location.href='<?php echo U('del',array('cid'=>$v['cid']));?>';"><i class="icon-trash icon-white"></i>删除</a>
									</td>
								</tr>
								<?php }?>
								<tr>
									<td colspan='4' align='center'>
										<input type="submit" value='排序' class="btn btn-primary"/>
									</td>
								</tr>
								</form>
						</tbody>
					</table>
				</div>
			</div>
		</div>
	</form>

<script type="text/javascript">
$(function(){
//	点击顶级分类的时候显示所有的子分类
	$('.open').toggle(function(){
		var cid = $(this).attr('cid');
		$('tr[pid=' + cid + ']').fadeIn(600);
	}, function(){
		var cid = $(this).attr('cid');
		$('tr[pid=' + cid + ']').fadeOut(600);
	});
});
</script>
</body>
</html>